var subject = {
  typeId: '',
  init: function (option) {
    for (var attr in option) {
      this[attr] = option[attr]
    }
    this.getData()
    this.renderBg()
  },
  getData: function () {
    if (!this.typeId) { return } 
    var data = getSpecialVodListByTypeId({ TYPEID: this.typeId })
    page.data.subject = data.data
    this.render()
  },
  renderBg: function () {
    try {
      var res = getTypeDetailInfo(this.typeId)
      var picture = res[0].typePicture[0].picPath3
      $("#main").css("background-image", "url(" + picture + ")")
    } catch (err) {
      console.log('logo setLogo error')
    }
  },
  render: function () {
    var subject = page.data.subject
    var html = ''
    for (var i = 0, l = subject.length; i < l; i++) {
      var picInfo = subject[i].picInfo
      var defaultSub = picInfo[0]
      var focusSub = picInfo[1]
      var defaultStyle = 'left:' + defaultSub.picLeft + 'px;top:' + defaultSub.picTop +
        'px;width:' + defaultSub.picWidth + 'px;height:' + defaultSub.picHeight + 'px;'
      // var focusStyle = 'left:' + focusSub.picLeft + 'px;top:' + focusSub.picTop +
      // 'px;width:' + focusSub.picWidth + 'px;height:' + focusSub.picHeight + 'px;'
      var defaultSrc = (defaultSub.pictures && defaultSub.pictures[0].fileurl) || ''
      var focusSrc = (focusSub.pictures && focusSub.pictures[0].fileurl) || ''
      html += '<div class="item" id="subject-' + i + '" style="' + defaultStyle + '">'
      html += '<img class="default" src="' + defaultSrc + '"/>'
      html += '<img class="active" src="' + focusSrc + '"/>'
      html += '</div>'
    }
    $('#subject').html(html)
  }
}